// 包装 i-radio-group
import { extractModel } from '@/utils/tools'

export default {
    name:'c-i-radio-group',
    functional:true,
    
    render(h, context){

        let {value, callback, conf} = extractModel(context);
        
        let {

            radios,
            size,
            type,

            disabled,
             
        } = conf

        function buildRadio(radios){
            radios = radios || [];
            
            let cache = [];
            
            Object.keys(radios).forEach(key =>{
                cache.push(<radio label={radios[key]} disabled={disabled}></radio>)
            })

            return cache
        }

        return (
            
            <radio-group 
            type={type} 
            size={size || 'small'}
            value={value} 
            onChange={callback} 
            onInput={callback}>
            {buildRadio(radios)}
            </radio-group>            
            
        )
        
    }

    
}